<?
	session_start();
	require 'DataLoad.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php 
 if (!CheckAdmin()) {
 	ReDirectUrl('default.php');
 	exit;
 }

?>

<html>
<head>
<title><?php echo $GuildName;?> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<?php echo $StylePath;?>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<?php echo $StylePath;?>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
</head>

<body>

<div class="header">
<?php require 'menu.php';?>
</div>
<div class="main">
<?php 
if (${"action"}=="Del" && is_numeric(${"id"})) {
gbookdelsql();
} 
guestlist();
?>
	</div>
<div id="footer"><?php require 'footer.php';?></div>

</body>
</html>

<?php 
function guestlist() {

	$Apage=30;
	$sql="select * from gbook order by id desc LIMIT 30";
	$HtmlText=$HtmlText."<table class='outframe interlace'>";
	$HtmlText=$HtmlText."<tr><th colspan='5'>留言管理</th></tr>";
	$HtmlText=$HtmlText."<tr class='coltitle'><td>ID</td><td>name</td><td>content</td><td>class</td><td>operation</td></tr>";
	$result = mysql_query($sql);
	if (mysql_num_rows($result)===0) {
		 $HtmlText=$HtmlText."<tr><td colspan='5'>没有记录</td></tr>";

	}
		else{
		if (isset($_GET['page']) && !empty($_GET['page']) && CheckAdmin()) {
			$page=checkatr($_GET['page']);

	 $sql='SELECT * FROM gbook LIMIT 0,'.($page-1)*30 .' ORDER BY id DESC';
	 $result=mysql_query($sql);
		} 
	 while ($row=mysql_fetch_assoc($result)) {
			$HtmlText=$HtmlText."<tr><td>".$row["id"]."</td><td>".htmlspecialchars($row["gbook_poster"])."</td><td>".htmlspecialchars($row["gbook_content"])."</td>";
			$HtmlText=$HtmlText."<td>".$row["gbook_raidid"]."</td><td><a href='?Action=Del&amp;id=".$row["id"]."'>删除</a></td></tr>";
		} 

		}

	$HtmlText=$HtmlText."</table>";
	$HtmlText=$HtmlText.$pages[$result][$Apage]["admin_guest.php"][10];
	$result->close;
	echo $HtmlText;
} 

function gbookdelsql() {
	extract($GLOBALS);

	$sql="Delete from gbook where id=".${"id"};
	$conn->execute($sql);
	return $function_ret;
} 
?>
